﻿Imports System.Data.SqlClient
Imports UTNComputers.clsCliente
Imports UTNComputers.clsCatalogo
Imports UTNComputers.clsEmpleado
Imports UTNComputers.clsVentas
Public Class clsOrden_Rma
    Private mOrdrma_Id As Int32
    Private mProd_id As Int32
    Private mCli_Id As Int32
    Private mVta_Id As Int32
    Private mNro_Serie As String
    Private mOrdrma_Fecha As Date
    Private mOrdrma_Falla_Cliente As String
    Private mDiagnostico As String
    Private mDesc_Diagnostico As String
    Private mEmp_Id As Int32
    Private mCliente As clsCliente
    Private mProducto As clsCatalogo
    Private mVenta As clsVentas
    Private mEmpleado As clsEmpleado
    Private mCod_Suc As Int32

    '/////////////////////////////////////////////////////////
    '/ Propiedades
    '/////////////////////////////////////////////////////////

    Public Property Ordrma_Id() As Int32
        Get
            Return mOrdrma_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mOrdrma_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de RMA. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property

    Public Property Prod_Id() As Int32
        Get
            Return mProd_id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mProd_id = value
            Else
                Throw New Exception("No se puede utilizar el código de producto. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Cli_Id() As Int32
        Get
            Return mCli_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCli_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de cliente. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Vta_Id() As Int32
        Get
            Return mVta_Id
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mVta_Id = value
            Else
                Throw New Exception("No se puede utilizar el código de venta. El código debe ser mayor a cero (0).")
            End If
        End Set
    End Property
    Public Property Nro_Serie() As String
        Get
            Return mNro_Serie
        End Get
        Set(ByVal value As String)
            mNro_Serie = Left(value, 20)
        End Set
    End Property

    Public Property Ordrma_Fecha() As Date
        Get
            Return mOrdrma_Fecha
        End Get
        Set(ByVal value As Date)
            mOrdrma_Fecha = value
        End Set
    End Property
    Public Property Ordrma_Falla_Cliente() As String
        Get
            Return mOrdrma_Falla_Cliente.Trim.ToUpper
        End Get
        Set(ByVal value As String)
            mOrdrma_Falla_Cliente = value.Trim.ToUpper
        End Set
    End Property
    Public Property Diagnostico() As String
        Get
            Return mDiagnostico
        End Get
        Set(ByVal value As String)
            If (value.Trim.Length = 1) Then
                mDiagnostico = value.Trim.ToUpper
            Else
                Throw New Exception("F.")
            End If

        End Set
    End Property
    Public Property Desc_Diagnostico() As String
        Get
            Return mDesc_Diagnostico
        End Get
        Set(ByVal value As String)
            mDiagnostico = value.Trim.ToUpper


        End Set
    End Property
    Public Property Emp_Id() As Int32
        Get
            Return mEmp_Id
        End Get
        Set(ByVal value As Int32)
            mEmp_Id = value
        End Set
    End Property
    Public Property Cliente() As clsCliente
        Get
            Return mCliente
        End Get
        Set(ByVal value As clsCliente)
            mCliente = value
        End Set
    End Property
    Public Property Producto() As clsCatalogo
        Get
            Return mProducto
        End Get
        Set(ByVal value As clsCatalogo)
            mProducto = value
        End Set
    End Property
    Public Property Venta() As clsVentas
        Get
            Return mVenta
        End Get
        Set(ByVal value As clsVentas)
            mVenta = value
        End Set
    End Property
    Public Property Empleado() As clsEmpleado
        Get
            Return mEmpleado
        End Get
        Set(ByVal value As clsEmpleado)
            mEmpleado = value
        End Set
    End Property
    Public Property Cod_Suc() As Int32
        Get
            Return mCod_Suc
        End Get
        Set(ByVal value As Int32)
            If value > 0 And value < 2000000000 Then
                mCod_Suc = value
            Else
                Throw New Exception("Codigo de sucursal incorrecto")
            End If
        End Set
    End Property

    '/////////////////////////////////////////////////////////
    '/ Métodos de la Clase
    '/////////////////////////////////////////////////////////

    '---------------------------------------------------------------------
    ' Constructor de la Clase
    '---------------------------------------------------------------------
    Public Sub New()

        MyBase.New()

    End Sub
    '---------------------------------------------------------------------
    ' Destructor de la Clase
    '---------------------------------------------------------------------
    Public Sub Dispose()

        MyBase.Finalize()

    End Sub


End Class
